#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int lengthOfLastWord(char * s)
{
    if (s == NULL) return 0;
    int str_len = strlen(s);
    int result = 0;
    for (int i = str_len - 1; i >= 0; i--)
    {
        if (s[i] == ' ' && result > 0)
            break;
        else if (s[i] == ' ')
            continue;
        result++;
        
    }
    return result;
}

int main(void)
{
    char source[] = "a";
    int result = lengthOfLastWord(source);
    printf("%d\n",result);
    return 0;
}